﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SQLEditor.admin.entity;

namespace SQLEditor.admin.service
{
    public class ProgExerciseService : BaseService
    {
        public string listQuestion(int userId)
        {
            var list = from b in DB.progQuestion
                       orderby b.id
                       select new ProgQuestion
                       {
                           id = b.id,
                           title = b.title,
                           remark = b.remark,
                           input = b.input,
                           output = b.output,
                           sorter = b.sorter,
                           userId = b.userId,
                           point = b.point,
                           status = b.progAnswer.Any(m => m.status == 1 && m.userId == userId) ? "Yes" : "No"
                       };
            string json = JsonUtil.ToJson(list.ToList());
            return json;
        }

        public void answer(int userId, int questionId, string answerSql)
        {
        }
    }
}